using Microsoft.Win32;
using UnityEngine;
using UnityEngine.UI;

public class BrushBar : ButtonGroupBase
{
    [SerializeField]
    BlockButton m_Pencil;
    [SerializeField]
    BlockButton m_Rubbish;

    [SerializeField]
    BlockButton m_Clear;

    [SerializeField]
    Button m_Save;
    [SerializeField]
    Button m_Load;

    [SerializeField]
    Text m_StageName;
    LogicEditMap GetLogic()
    {
        return LogicManager.Instance().GetCurLogic() as LogicEditMap;
    }

    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        AddButton(m_Pencil);
        AddButton(m_Rubbish);
        AddButton(m_Clear);

        FreshButton();

        m_Save.onClick.AddListener(FileOp.OnSave);
        m_Load.onClick.AddListener(FileOp.OnLoad);
    }

  
    void FreshSceneData()
    {
        m_StageName.text = SceneMgr.Instance().CurSceneName;
    }
    protected override void OnClickButton( int index )
    {
        switch (index)
        {
            case 0:
                GetLogic().SetPushMode();
                break;
            case 1:
                GetLogic().SetErasureMode();
                break;
            case 2:
                GetLogic().DoClearMap();
                break;
            case 3:
                break;
        }
    }
     
}
